var api = require('../../utils/api.js');
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        date:'',
        times:'',
        name:'',
        mobile:'',
        sf:'',
        sehnf:['店员','公司人员','销售-合伙人方向'],
        array:['下午1点开始','下午3点开始','下午5点开始']
    },
    onLoad(){
     },

     getname(re){
        this.setData({
            name:re.detail.value
        })
     },
     getmobile(ret){
        this.setData({
            mobile:ret.detail.value
        })
     },

     bindDateChange(ret){
        console.log(ret);
        var date=ret.detail.value;

        this.setData({
            date:date
        })
     },
     bindPickerChanges(ret){
        console.log(ret);
        var index=ret.detail.value;
        var list=this.data.array;
        this.setData({
            times:list[index]
        })
     },

     bindPickerChangesf(ret){
        console.log(ret);
        var index=ret.detail.value;
        var list=this.data.sehnf;
        this.setData({
            sf:list[index]
        })
     },

    submits(){
        var that=this;
        var name=this.data.name;
        var mobile=this.data.mobile;
        var date=this.data.date;
        var times=this.data.times;
        var sf=this.data.sf;

        api.post({
            url: 'yuyue/applys',
            data: {name:name,mobile:mobile,date:date,times:times,sf:sf},
            success: data => {
                console.log(data);
                
                wx.showToast({
                  title: data.msg,
                  icon:'none'
                })
            }
        });

    },
})